package designmode.simplefactory;

public class Order {
    //组合pizza类和simplefactory类
    Pizza pizza;
    SimpleFactory simpleFactory;
    public Order(SimpleFactory simpleFactory){
        setFactory(simpleFactory);
    }

    private void setFactory(SimpleFactory simpleFactory) {
        this.simpleFactory=simpleFactory;
        String orderType="";
        do{
            //orderType=getType();
            pizza = simpleFactory.createPizza(orderType);
            if (null!=pizza){
                pizza.prepare();
                pizza.bake();
            }
        }while (true);
    }
}
